home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr23 / tlxtw204.zip / CRAI.SLT < prev    next >
Text File  |  1995-01-21  |  5KB  |  147 lines

  1. // see lines 55 - 63 approximately
  2. //////////////////////////////////////////////////////////////////////////////
  3. // Crai.slt = Ctrl-C
  4. ///////////////////////////////////////////////////////////////////////////////
  5. str  f1[64],
  6.      bbsname[8], buf[40], shortname[12],
  7.      capfname[64],
  8.      tmpdir[64], msg[64], exe[64],
  9.      drs[3];
  10. int  i,x,y,cs,dr,statline,statline_color;
  11. ///////////////////////////////////////////////////////////////////////////////
  12. main()
  13. {
  14.     _scr_chk_key=0;
  15.     update_term();
  16.     cursor_onoff(1);
  17.     if(!getenv("f1",f1)) {
  18.         soft_wind("F1 environment variable not found", 25);
  19.         _scr_chk_key=1;
  20.         return 0;
  21.     }
  22.     i=subchr(f1,strlen(f1)-1);if(i!='\')strcat(f1,"\");
  23.     if(carrier())
  24.         if (!chk_prompt("Command [TL")) {
  25.             soft_wind("Must be at the ^0034Command [TL=^0034 prompt.", 25);
  26.             _scr_chk_key=1;
  27.             return 0;
  28.         }
  29.     if(!strlen(_entry_name))
  30.         if (call("bbsname") == -1) {
  31.             _scr_chk_key = 1;
  32.             return 0;
  33.         }
  34.     _scr_chk_key = 0;
  35.     bbsname=_entry_name;
  36.     fill_spaces();
  37.     strcat(f1, bbsname);
  38.     subchrs(bbsname, 0, 3, shortname);
  39.     strcat(f1, "\");
  40.     exe=_script_dir;
  41.     if(subchr(exe,strlen(exe)-1)!='\')strcat(exe, "\");
  42.         strcat( exe, "Crai.exe" );
  43.     if ( !filefind( exe,0 ) ) {
  44.         soft_wind("Crai.exe not found in script directory." ,40);
  45.         _scr_chk_key = 1;
  46.         return 0;
  47.     }
  48.     if(filefind(_capture_fname) != 0 )  // look for default cap first
  49.         capfname = _capture_fname;
  50.     else                                // assume its in the game's dir
  51.         fnstrip( _capture_fname, 3, capfname );
  52.  
  53.     // capfname="C:\Telix\Telix.cap";
  54.     // uncomment above to hard code in the cap file.
  55.  
  56.     newdir(f1); // change to the game's directory
  57.     if(!filefind( capfname )) {
  58.         soft_wind( "Unable to find capture file", 30);
  59.         soft_wind( capfname, 50 );
  60.         // above line will show which file it can't find, if it happens again,
  61.         // make a note of the filename and let me know.
  62.         //
  63.         return 0;
  64.     }
  65.     cs=capture_stat();
  66.     capture("*close*");
  67.     strcat(exe," ");
  68.     strcat(exe, capfname);
  69.     strcat(exe," ");
  70.     strcat(exe, shortname);
  71.     strcat(exe," /p8 /m /v"); // command line switches for crai.exe
  72.     //soft_wind(exe,100);
  73.     i=dos(exe,0);
  74.     if      ( cs == 1 )   capture(_capture_fname);
  75.     else if ( cs == 2 ) {capture(_capture_fname); capture("*pause*");}
  76.     newdir( _telix_dir );
  77.     return 1;
  78. }
  79. ///////////////////////////////////////////////////////////////////////////////
  80. //                            Check Prompt
  81. chk_prompt(str prompt)
  82. {
  83.   int          l, h, key, old_chk_key, ts;
  84.   str          promptbuf[20];
  85.  
  86.   _scr_chk_key = old_chk_key; _scr_chk_key = 0;
  87.   cursor_onoff(0);
  88.   l = strlen( prompt );
  89.   x=getx(); y=gety();
  90.   vgetchrs(0, y, promptbuf, 0, l);
  91.   gotoxy(2,y); gotoxy(x,y);
  92.   cursor_onoff(1);
  93.   _scr_chk_key = old_chk_key;
  94.   if (strcmpi(prompt, promptbuf) != 0)
  95.       return 0;
  96.   return 1;
  97. }
  98. ///////////////////////////////////////////////////////////////////////////////
  99. //                         Soft Wind
  100. soft_wind(str message, int duration)
  101. {
  102.   int old_chk_key;
  103.   old_chk_key = _scr_chk_key;
  104.   _scr_chk_key = 0;
  105.   int l, h, x, y, key = 0, ts;
  106.   cursor_onoff(0);
  107.   x=getx(); y=gety();
  108.   l = strlen(message)/2;
  109.   h = vsavearea(37-l, 10, 43+l, 14);
  110.   box(37-l, 10, 43+l, 14, 3, 0, 5 );
  111.   pstraxy(message, 40-l  , 12, 11 );
  112.   ts = timer_start(duration);
  113.   while( !key && !time_up(ts)) key=inkey();
  114.   vrstrarea(h);
  115.   cursor_onoff(1);
  116.   gotoxy(x,y);
  117.   timer_free(ts);
  118.   _scr_chk_key = old_chk_key;
  119.   return key;
  120. }
  121. //////////////////////////////////////////////////////////////////////////////
  122. //              Filters out characters illegal in DOS filenames.
  123. fill_spaces()
  124. {
  125.  str    chr[1];
  126.  int    count = 0;
  127.  
  128.  while (count < 6) {
  129.         if (count == 0) chr = ".";
  130.     else if (count == 1) chr = "+";
  131.     else if (count == 2) chr = " ";
  132.     else if (count == 3) chr = "?";
  133.     else if (count == 4) chr = "*";
  134.     else if (count == 5) chr = "/";
  135.     i=0;
  136.         while (1) {
  137.             i = strpos(bbsname, chr, i);
  138.             if (i == -1) break;
  139.             setchr(bbsname, i ,'_');
  140.             i = i + 1;
  141.         }
  142.         ++count;
  143.     }
  144.     return 1;
  145. }
  146. ///////////////////////////////////////////////////////////////////////////////
  147.